using System.Security.Cryptography;
using System.Text;

namespace Utils;


public static class SHA256Helper {
  public static string Parse(Stream stream) {
    var sha256 = SHA256.Create();
    stream.Position = 0;
    byte[] bytes = sha256.ComputeHash(stream);
    StringBuilder sb = new StringBuilder();
    foreach (byte b in bytes) {
      sb.Append(b.ToString("X2"));
    }
    stream.Position = 0;
    return sb.ToString();
  }
}